package demo1210.pm.pm1;

/*
Math数学类
静态的字段:
1.public static final double E=2.7182818284590452354;
2.public static final double PI = 3.14159265358979323846;

静态的方法:
1.public static 整数/小数 abs(整数/小数 a);
返回的是当前变量的绝对值.
2.public static double pow(double a,double b);
返回的是a的b次幂
3.public static double ceil(double a);向上取整
返回：最小（最接近负无穷大）浮点值，该值大于等于该参数，并等于某个整数。

4.public static double floor(double a);向下取整
返回：最大（最接近正无穷大）浮点值，该值小于等于该参数，并等于某个整数。
5.public static long round(double a);四舍五入
返回：舍入为最接近的 long 值的参数值。

 */
public class Demo_02 {
    public static void main(String[] args) {
        System.out.println(Math.ceil(12.1));//13.0
        System.out.println(Math.floor(12.9));//12.0
        System.out.println(Math.round(12.49));//12
        System.out.println(Math.round(12.50));//13
        System.out.println(Math.sin(Math.PI/6));//
        demo01();
    }

    private static void demo01() {
        System.out.println(Math.E);
        System.out.println(Math.PI);
        double pow = Math.pow(2, 10);
        System.out.println(pow);
        int abs = Math.abs(-10);
        System.out.println(abs);//10
/*
        2.718281828459045
        3.141592653589793
        1024.0
        10

        */
    }
}

